<!--#
layout("/layouts/platform.html"){
#-->
<header class="header navbar bg-white shadow">
	<div class="btn-group tool-button">
		<a class="btn btn-primary navbar-btn" href="${base}/platform/store/config/class"
			data-pjax id="goback"><i class="ti-angle-left"></i>${msg['store.class.return']}</a>
	</div>
</header>

<div class="content-wrap">
	<div class="wrapper" style="min-height: 500px;">
		<section class="panel panel-form">
			<form id="unitAddForm" role="form"
				class="form-horizontal parsley-form" data-parsley-validate
				action="${base}/platform/store/config/class/editDo" method="post">
				<input name="id" type="hidden" value="${obj.id!}"> <input
					type="hidden" id="hasChildren" name="hasChildren"
					value="${obj.hasChildren!}">
				<div class="row mb10 mt10">
					<div class="col-lg-12">
						<div class="form-group has-feedback">
							<label for="parentId" class="col-sm-2 control-label">${msg['store.class.upper']}</label>
							<div class="col-sm-8">
								<input id="parentId" type="text" class="form-control" disabled placeholder="${msg['store.class.default']}"
									   value="<!--#if(!isEmpty(parentUnit)){#-->${parentUnit.name}<!--#}#-->"/>

								<input type="hidden" name="parentId" value="<!--#if(!isEmpty(parentUnit)){#-->${parentUnit.id}<!--#}#-->">
							</div>
						</div>
						<div class="form-group">
							<label for="name" class="col-sm-2 control-label">${msg['store.class.column.name']}</label>

							<div class="col-sm-8">
								<input type="text" id="name" class="form-control" name="name"
									data-parsley-required="true"
									placeholder="${msg['store.class.column.name']}" value="${obj.name!}">
							</div>
						</div>
						<div class="form-group">
							<label for="deposit" class="col-sm-2 control-label">${msg['store.class.column.deposit']}</label>

							<div class="col-sm-8">
								<input type="text" id="deposit" class="form-control" name="deposit"
									placeholder="${msg['store.class.column.deposit']}" value="${obj.deposit!}" data-parsley-type="integer" data-parsley-required="true">
							</div>
						</div>
					</div>
				</div>
				<div class="col-lg-3"></div>
				<div class="col-lg-6">
					<div class="form-group text-center">
						<label></label>
						<div>
							<button class="btn btn-primary btn-block btn-lg btn-parsley"
								data-loading-text="${msg['store.class.submiting']}">${msg['store.class.submit']}</button>
						</div>
					</div>
				</div>
			</form>
		</section>
	</div>
</div>
<a class="exit-offscreen"></a>
<!-- 选择上级单位 -->
<div id="dialogSelectParentUnit" class="modal fade bs-modal-sm"
	tabindex="-1" role="dialog" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
					aria-hidden="true">×</button>
				<h4 class="modal-title">${msg['store.class.selectupper']}</h4>
			</div>
			<div class="modal-body">
				<div class="row">
					<div class="col-xs-12">
						<div id="jsTreeParentUnit" class="demo"></div>
					</div>
				</div>
			</div>
			<div class="modal-footer">
				<div class="pull-left">
					<button type="button" class="btn btn-success" data-dismiss="modal"
						onclick="selectFirstMenu()">${msg['store.class.settop']}</button>
				</div>
				<button type="button" class="btn btn-default" data-dismiss="modal">${msg['store.class.cancel']}</button>
				<button type="button" class="btn btn-primary"
					onclick="selectParentMenu()">${msg['store.class.determineselect']}</button>
			</div>
		</div>
	</div>
</div>
<script language="JavaScript">
    $(document).ready(function () {
        $('#unitAddForm').ajaxForm({
            dataType: 'json',
            beforeSubmit: function (arr, form, options) {
                form.find("button:submit").button("loading");
            },
            success: function (data, statusText, xhr, form) {
                if (data.code==0) {
                    Toast.success(data.msg);
                    setTimeout(function () {
                        $("#goback").trigger("click");
                    }, 1000);
                } else {
                    Toast.error(data.msg);
                }
                form.find("button:submit").button("reset");
            }
        });
    });

</script>

<!--#}#-->